package com.jiazhong.可变参数;

public class Demo01 {
    public static void main(String[] args) {
        Grade grade = new Grade();
        System.out.println(grade.getGrade("abaaba", 1, 2, 3, 4, 5, 6));
    }
}

class Grade {
    public String getGrade(String name, double... grades) {
        int sum = 0;
        for (int i = 0; i < grades.length; i++) {
            sum += grades[i];
        }
        return name + "有" + grades.length + "门课总成绩为" + sum;
    }
}
